package cn.edu.scau.cmi.zengGuanSheng.comprehensiveExperiment;

import javafx.fxml.FXML;

import javafx.scene.control.Button;
import javafx.stage.Stage;
import cn.edu.scau.cmi.zengGuanSheng.abstractFactoryPattern.AbstractFactoryClientForComprehensiveExperiment;
import cn.edu.scau.cmi.zengGuanSheng.adapterPattern.AdapterOfClassClient;
import cn.edu.scau.cmi.zengGuanSheng.adapterPattern.AdapterOfObjectClient;
import cn.edu.scau.cmi.zengGuanSheng.client.Chairman1Client;
import cn.edu.scau.cmi.zengGuanSheng.client.Marshal1Client;
import cn.edu.scau.cmi.zengGuanSheng.composite.consistent.ConsistentClient1;
import cn.edu.scau.cmi.zengGuanSheng.composite.safe.SafeClient1;
import cn.edu.scau.cmi.zengGuanSheng.factoryPattern.FactoryClientForComprehensiveExperiment;
import cn.edu.scau.cmi.zengGuanSheng.simpleFactoryPattern.SimpleFactoryClientForComprehensiveExperiment;
import javafx.event.ActionEvent;

public class MainSceneController {
	@FXML
	private Button btn_singleton;
	@FXML
	private Button btn_multiple;
	@FXML
	private Button btn_simpleFactory;
	@FXML
	private Button btn_factory;
	@FXML
	private Button btn_abstractFactory;
	@FXML
	private Button btn_adapterOfClass;
	@FXML
	private Button btn_adapterOfObject;
	@FXML
	private Button btn_composite_safe;
	@FXML
	private Button btn_composite_consistent;

	//实验二：单例模式
	// Event Listener on Button[#btn_singleton].onAction
	@FXML
	public void eventSingleton(ActionEvent event) {
		// TODO Autogenerated
		Chairman1Client client = new Chairman1Client();
		client.start(MainClient.primaryStage);
//		client.start(new Stage());//打开新的窗口
	}
	
	//实验二：多例模式
	// Event Listener on Button[#btn_multiple].onAction
	@FXML
	public void eventMultiple(ActionEvent event) {
		// TODO Autogenerated
		Marshal1Client client = new Marshal1Client();
		client.start(MainClient.primaryStage);
	}
	
	//实验三：简单工厂模式
	// Event Listener on Button[#btn_simpleFactory].onAction
	@FXML
	public void eventSimpleFactory(ActionEvent event) {
		// TODO Autogenerated
		SimpleFactoryClientForComprehensiveExperiment client = new SimpleFactoryClientForComprehensiveExperiment();
		client.start(MainClient.primaryStage);
	}
	
	//实验三：工厂模式
	// Event Listener on Button[#btn_factory].onAction
	@FXML
	public void eventFactory(ActionEvent event) {
		// TODO Autogenerated
		FactoryClientForComprehensiveExperiment client = new FactoryClientForComprehensiveExperiment();
		client.start(MainClient.primaryStage);
	}
	
	//实验三：抽象工厂模式
	// Event Listener on Button[#btn_abstractFactory].onAction
	@FXML
	public void eventAbstractFactory(ActionEvent event) {
		// TODO Autogenerated
		AbstractFactoryClientForComprehensiveExperiment client = new AbstractFactoryClientForComprehensiveExperiment();
		client.start(MainClient.primaryStage);
	}
	
	//实验四：类适配器模式
	// Event Listener on Button[#btn_adapterOfClass].onAction
	@FXML
	public void eventAdapterOfClass(ActionEvent event) {
		// TODO Autogenerated
		AdapterOfClassClient client = new AdapterOfClassClient();
		client.start(MainClient.primaryStage);
	}
	
	//实验四：对象适配模式
	// Event Listener on Button[#btn_adapterOfObject].onAction
	@FXML
	public void eventAdapterOfObject(ActionEvent event) {
		// TODO Autogenerated
		AdapterOfObjectClient client = new AdapterOfObjectClient();
		client.start(MainClient.primaryStage);
	}
	
	//实验五：安全型组合模式
	// Event Listener on Button[#btn_composite_safe].onAction
	@FXML
	public void eventComposite_safe(ActionEvent event) {
		// TODO Autogenerated
		SafeClient1 client = new SafeClient1();
		client.start(MainClient.primaryStage);
	}
	
	//实验五：一致型组合模式
	// Event Listener on Button[#btn_composite_consistent].onAction
	@FXML
	public void eventComposite_consistent(ActionEvent event) {
		// TODO Autogenerated
		ConsistentClient1 client = new ConsistentClient1();
		client.start(MainClient.primaryStage);
	}
}
